	var img = sessionStorage.getItem('dai');
	$('.imgn').attr('src',img);
	var spId = globalFun.GetQueryString("spId");
	var poduct = sessionStorage.getItem('poduct');
//点击回复 弹框出现
$('.pinglun').on('click', function() {
	$('.projectileFrame').show();
});
$('.navDp-img').click(function () {
	location.href='../shopDetail/cart.html';
});
//点击回复 弹框消失
$(document).on('click','.pinglun', function() {
	$('.projectileFrame').show();
	 $(".replyText").val('');
	var commentId=$(this).attr("data-id");
	var operationId=$(this).attr("data-mid");
	var objectName=$(this).attr("data-wid");
	
	$('.huifu').attr("data-id",commentId).attr("data-mid",operationId).attr("data-wid",objectName);
});
//回复
$(document).on('click','.huifu', function () { 
	var commentId=$(this).attr("data-id");
	var operationId=$(this).attr("data-mid");
	var objectName=$(this).attr("data-wid");
	var zxContent = $(".replyText").val();
//	console.log($(".replyText").val());
//	console.log($(".replyText"));
	if (zxContent == "" || zxContent.length == 0) {
		tips("评论内容不能为空");
		return false;
	}
	if (zxContent.length > 140) {
		tips("评论内容不能超过140字");
		return false;
	}
	$('.projectileFrame').hide();
	
	
	$.ajax({
		type: "post",
		url: apicom + "mobile/after/order/ordercomment/replyComment",
		data: {
			id:user_info.id,
			commentId:commentId,
			content:zxContent,
			operationId: operationId,
			operationObjectId:commentId,
			objectName:objectName,
			uuid:user_info.uuid,
			phone:user_info.phone	
		},
		dataType: "json",
		success: function(res) {
			if (typeof(res) == 'string') {
				res = JSON.parse(res);
			}
			if (res.code == 1) {
//				console.log(111);
				location.reload();
			} else {
				tips(res.msg);
			}
			
		},
		error: function(err) {
			console.log(err)
		}
	})
	
});
//全部样式切换
$(".home_xq1").on("click", "span", function() {
	$(this).css('background', '#F25C5C').siblings().css('background', 'rgba(255,235,234,1)');
});
//全部
$('.quanbu').click(function() {
//	$('.conent1').show();
//	$('.conent2').hide();
//	$('.conent3').hide();
//	$('.conent4').hide();
getDataList(0, 1)
});
//好评
$('.haoping').click(function() {
//	$('.conent2').show();
//	$('.conent1').hide();
//	$('.conent3').hide();
//	$('.conent4').hide();
getDataList(1, 1);
});
//中评
$('.zhongping').click(function() {
//	$('.conent3').show();
//	$('.conent1').hide();
//	$('.conent2').hide();
//	$('.conent4').hide();
getDataList(2, 1)
});
//差评
$('.chaping').click(function() {
//	$('.conent4').show();
//	$('.conent1').hide();
//	$('.conent2').hide();
//	$('.conent3').hide();
getDataList(3, 1)
});
var id = globalFun.GetQueryString("id")
//id = 2963
getDataList(0, 1)
/* 获取评论列表 */
function getDataList(level, page) {
	
	if(!Auth()){
		var pai = {
			productId: spId,
			level: level,
			page: page,
			rows: 10
		}
		
	}else{
		var pai = {
			productId: spId,
			level: level,
			page: page,
			rows: 10,
			uuid:user_info.uuid,
			phone:user_info.phone,
			memberId:user_info.id
		}
	}
	
	$.ajax({
		type: "post",
		url: apicom + "mobile/view/ordercomment/getOrderCommentList",
		data: pai,
		dataType: "json",
		success: function(res) {
			if (typeof(res) == 'string') {
				res = JSON.parse(res);
			}
			if (res.code == 1) {
				renderData(res.content)
			} else {
				tips(res.msg);
			}
		},
		error: function(err) {
			console.log(err)
		}
	})
}
/* 页面回显评论列表 */
function renderData(datalist) {
	var content = "";
	for (var l = 0; l < datalist.length; l++) {
		var data = datalist[l]
		content += '<div><div class="current-in"><ul><li class="current-tx">'
		
		if(data.logo == "") {
			content += '<img src="https:yst-pjyc-server.oss-cn-beijing.aliyuncs.com/datas/image/20180611/20180611170204559233380.png"/>'
		} else {
			content += '<img src = "' + data.logo + '" />'
		}
		
		content += '<li   class="current-name">' + data.memberName + '</li>'
		content += '<li class = "current-xj" >'
		for (var i = 0; i < 5; i++) {
			if (i < data.startNum) {
				content += '<img src = "../../img/d_staryou.png" />'
			} else {
				content += '<img src = "../../img/d_starwu.png" />'
			}
		}
		content += '</li></ul><div class="current-time">';
		content += '<span class="current-time1">' + data.createdTime + '</span>'
		content += '<span class="current-time2"> 规格：' + data.specificationName + '</span></div>'
		content += '<div class = "current-hp" >';
		content += '<span class="current-hp1">' + data.content + '</span> </div >';


		if (data.picture) {
			content += '<div class = "current-tp" >'
			var picture = data.picture.split(",")
			for (var i = 0; i < picture.length; i++) {
				content += '<div style="background-image:url(' + picture[i] + ')"></div>'
			}
			content += '</div>'
		}
		
			for(var i = 0; i< data.returnOrderCommentVOS.length;i++){
			if(data.returnOrderCommentVOS[i].memberName){
				content += '<div class = "home_sjhf" >'
		
				content += '<span >'+data.returnOrderCommentVOS[i].memberName+' :<b>'+data.returnOrderCommentVOS[i].content +'<b></span></div>'
			}else{
				content += '<div class = "home_sjhf" >'
				content += '<img src="../../img/w_huifu.png" class="sjhf"/>'
		
				content += '<span >商家： <b>'+data.returnOrderCommentVOS[i].content +'<b></span></div>'
			}
				
		}
		
		
		
		content += '<div class = "active1"><span class="liulan">浏览<b>'+  data.readNum +'次</b></span><span data-id="'+data.id+'" class = "dianzan">'
		
		if(data.isFabulous == 0){
			content+='<img data-type="1"  src="../../img/a_zan.png"/>'
		}else{
			content+='<img data-type="2"  src="../../img/a_zan_1.png"/>'
		}
		
		content += '<b class="dianzanj">' + data.fabulousNum + '</b> </span >'
		content += '<span data-wid="'+data.memberName+'" data-mid="'+data.memberId+'" data-id="'+data.id+'" class = "dianzan1 pinglun" >'
		content += '<img src="../../img/w_huifu.png"/><b  >回复</b></span></div></div>'
	}
	$(".conent1").html(content)
//	returnConent
}

//点赞
$(document).on('click','.dianzan',function(){
	if(Auth()) {
			uuid = user_info.uuid;
			phone = user_info.phone;
			id  = user_info.id;
		}else{
			toClientLogin()
		}
	var dianzan1 = $(this);
	var zt = $(this).children("img").attr("data-type");
	console.log(zt)
	var pid = $(this).attr('data-id');
	if(!Auth()){
		toClientLogin();
	}else{
	 	if(zt == 1){
	 		$(this).children("img").attr("data-type",2);
	 		console.log(111)
	 		$.ajax({
	 			type:"post",
	 			url:apicom+"mobile/after/consulationfabulous/fabulous",
	 			data:{
	 				consultationId:'',
	 				type:1,
	 				planId:'',
	 				consultationType:5,
	 				consultationCommentId:'',
	 				productId:id,
	 				orderCommentId: pid,
	 				phone:user_info.phone,
	 				uuid:user_info.uuid,
	 			},
	 			success:function(res){
			        if(typeof res == "string"){
			            var data=JSON.parse(res);
			        }else{
			            var data=res;
			        }	
			        if(data.code == 1){
			        	tips(data.msg);
//			        	dianzan1.addClass('red');
			        	dianzan1.find('img').attr('src','../../img/a_zan_1.png');
			        	var str1 = dianzan1.find('.dianzanj').html();
			        	dianzan1.find('.dianzanj').html( str1*1 + 1);
			        	
			        }
	 			},
	 			error:function(err){
	 				tips("服务器错误!");
	 			}
	 		});
	 	}else{
	 		console.log(222)
	 		$(this).children("img").attr("data-type",1);
	 		$.ajax({
	 			type:"post",
	 			url:apicom+"mobile/after/consulationfabulous/fabulous",
	 			data:{
	 				consultationId:'',
	 				type:2,
	 				planId:'',
	 				consultationType:5,
	 				consultationCommentId:'',
	 				productId:id,
	 				orderCommentId: pid,
	 				phone:user_info.phone,
	 				uuid:user_info.uuid
	 			},
	 			success:function(res){
			        if(typeof res == "string"){
			            var data=JSON.parse(res);
			        }else{
			            var data=res;
			        }	
			        if(data.code == 1){
			        	tips("取消点赞");
//			        	dianzan1.removeClass('red');
			        	dianzan1.find('img').attr('src','../../img/a_zan.png');
			        	var str1 = dianzan1.find('.dianzanj').html();
			        	dianzan1.find('.dianzanj').html( str1*1 -1 );


			        }
	 			},
	 			error:function(err){
	 				tips("服务器错误!");
	 			}
	 		});		
	 	}	
	}

 });
 

//
var hunterId = globalFun.GetQueryString("hunter_id");
$.ajax({
	type:"post",
	url:apicom+"mobile/view/product/selectproductdetail",
	data:{
		id:spId,
   	 	phone: user_info.phone,
    	type: 0,
    	hunterId: hunterId,
   	 	memberId: user_info.id,
	},
	success:function(res){
        if(typeof res == "string"){
            var data=JSON.parse(res);
        }else{
            var data=res;
        }
        var xqContent='';
        if(data.code == 1){
        	
//      	data=data.content;
//      	fwType=data.type;
//      	fwImg=data.detailImgeList[0].imageAddress;
//      	endtime=data.service_end_time;
//      	starttime=data.service_start_time;
//      	merchant_id=data.merchant_id;
        	if(data.isFollow){
        		//1 已收藏   0 未收藏
        		isFollow=data.isFollow;
	        	if(isFollow == 0){
	      		$(".navDp-img1 img").attr("src","../../img/d_xin.png");
//					$(".navFx-img").removeClass("red");
	        	}else{
	      		$(".navDp-img1 img").attr("src","../../img/w_fenxiangtubiao.png");
//				$(".navFx-img").addClass("red");
	        	}
        	}else{
        		
        	}
        	$(".pinglunshu1").html(data.content.allCommentNum);
        	$(".pinglunshu2").html(data.content.goodCommentNum);
        	$(".pinglunshu3").html(data.content.secondCommentNum);
        	$(".pinglunshu4").html(data.content.badCommentNum);
        	
        	
        	
        }
	},
	error:function(err){
		tips("服务器错误!");
	}
});

/* 分享 */
function toAppShare(data, self) {
  if ($(self).hasClass("dis")) {
    return false
  }
  $(self).addClass("dis")
  setTimeout(function() {
    $(self).removeClass("dis")
  }, 1000)
  if (Auth()) {

  } else {
    // toClientLogin(location.href)
    // return false;
  }
  var JSONstr = JSON.stringify(data);
  if (mark === 0) {
    //var result = lase;
    window.stub.jsToClientShare(JSONstr); //用接口stub, 通过调用内部类中的方法jsMethod给java传回result。
  } else if (mark === 1) {
    //在改function 中添加原生调起js方法
     data = JSON.parse(data);
    setupWebViewJavascriptBridge(function(bridge) {
      bridge.callHandler('jsToClientShare', data, function(resp) {});
    });
  }

}
$(".navFx-img").click(function() {
  	toAppShare(poduct, this);
});


//收藏
$('.navDp-imga').click(function() {
  var $this = $(this);
  if (!Auth()) {
    toClientLogin();
  } else {
    if ($(this).hasClass("red")) {
      $.ajax({
        type: "post",
        url: apicom + "mobile/after/memberfollow/collection",
        data: {
          consultationId: '',
          planId: '',
          uuid: user_info.uuid,
          phone: user_info.phone,
          type: 7,
          productId: spId,
          memberId: user_info.id
        },
        success: function(res) {
          if (typeof res == "string") {
            var data = JSON.parse(res);
          } else {
            var data = res;
          }
          if (data.code == 1) {
            $this.removeClass("red")
            tips("取消收藏");
            $this.attr('src','../../img/w_xin.png');
            //			        	location.reload();
          }
        },
        error: function(err) {
          tips("服务器错误!");
        }
      });
    } else {
      $.ajax({
        type: "post",
        url: apicom + "mobile/after/memberfollow/collection",
        data: {
          consultationId: '',
          planId: '',
          uuid: user_info.uuid,
          phone: user_info.phone,
          type: 4,
          productId: spId,
          memberId: user_info.id
        },
        success: function(res) {
          if (typeof res == "string") {
            var data = JSON.parse(res);
          } else {
            var data = res;
          }
          if (data.code == 1) {
            $this.addClass("red")
            $this.attr('src','../../img/w_fenxiangtubiao.png');
            tips("收藏成功");
            //			        	location.reload();
          }
        },
        error: function(err) {
          tips("服务器错误!");
        }
      });
    }
  }

});
var level = globalFun.GetQueryString("type");
//详情页跳转详情列表对应评价类型
if(level == 0) { //全部
	$('.quanbu').css('background', '#F25C5C').siblings().css('background', 'rgba(255,235,234,1)');
} else if(level == 1) { //好评
	$('.haoping').css('background', '#F25C5C').siblings().css('background', 'rgba(255,235,234,1)');
} else if(level == 2) { //中评
	$('.zhongping').css('background', '#F25C5C').siblings().css('background', 'rgba(255,235,234,1)');
} else if(level == 3) { //差评
	$('.chaping').css('background', '#F25C5C').siblings().css('background', 'rgba(255,235,234,1)');
}